using System;
using Volo.Abp.Domain.Entities.Auditing;

namespace BW.WMS.WareHouseManage
{
    /// <summary>
    /// 操作记录实体 - 用于跟踪仓库管理相关的操作
    /// </summary>
    public class OperationLog : FullAuditedEntity<Guid>
    {
        /// <summary>
        /// 操作类型 (1-入库，2-出库，3-移库，4-盘点，5-调整，6-锁定，7-解锁)
        /// </summary>
        public int OperationType { get; set; }
        
        /// <summary>
        /// 操作对象ID (如库位ID、物料ID等)
        /// </summary>
        public Guid ObjectId { get; set; }
        
        /// <summary>
        /// 操作对象类型 (1-仓库，2-库区，3-库位，4-物料，5-库存)
        /// </summary>
        public int ObjectType { get; set; }
        
        /// <summary>
        /// 操作对象编码 (如库位编码、物料编码等)
        /// </summary>
        public string ObjectCode { get; set; }
        
        /// <summary>
        /// 操作时间
        /// </summary>
        public DateTime OperationTime { get; set; }
        
        /// <summary>
        /// 操作人ID
        /// </summary>
        public Guid OperatorId { get; set; }
        
        /// <summary>
        /// 操作人名称
        /// </summary>
        public string OperatorName { get; set; }
        
        /// <summary>
        /// 操作描述
        /// </summary>
        public string Description { get; set; }
        
        /// <summary>
        /// 操作前值
        /// </summary>
        public string BeforeValue { get; set; }
        
        /// <summary>
        /// 操作后值
        /// </summary>
        public string AfterValue { get; set; }
        
        /// <summary>
        /// 相关单据号
        /// </summary>
        public string RelatedDocumentNo { get; set; }
        
        /// <summary>
        /// IP地址
        /// </summary>
        public string IpAddress { get; set; }
        
        protected OperationLog()
        {
        }
        
        public OperationLog(
            Guid id,
            int operationType,
            Guid objectId,
            int objectType,
            string objectCode,
            Guid operatorId,
            string operatorName,
            string description,
            string beforeValue = null,
            string afterValue = null) : base(id)
        {
            OperationType = operationType;
            ObjectId = objectId;
            ObjectType = objectType;
            ObjectCode = objectCode;
            OperationTime = DateTime.Now;
            OperatorId = operatorId;
            OperatorName = operatorName;
            Description = description;
            BeforeValue = beforeValue;
            AfterValue = afterValue;
        }
    }
} 